<template>
  <el-dialog title="预览文章" :visible="value" width="60%" @close="close">
    <h3>{{ form.title }}</h3>
    <div class="header">
      <span>{{ form.createTime }}</span
      ><span>{{ form.creatorID }}</span
      ><span><i class="el-icon-view"></i></span>{{ form.visits }}
    </div>
    <div class="content">
      <p type="textarea" v-html="form.articleBody"></p>
    </div>

    <!-- <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
    </span> -->
  </el-dialog>
</template>
<script>
import { getArticlesDetailRequest } from '../../api/hmmm/articles-list'
export default {
  props: {
    value: {
      type: Boolean,
      required: true
    },
    id: {
      type: Number,
      required: true
    }
  },
  data () {
    return {
      form: ''
    }
  },
  created () {
    this.getArticlesDetail()
  },
  methods: {
    // 获取详情
    async getArticlesDetail () {
      console.log(this.id, '444')
      const res = await getArticlesDetailRequest(this.id)
      this.form = res.data
    },
    close () {
      this.$emit('input', false)
    }
  }
}
</script>
<style lang="scss" scoped>
.content {
  border-top: 1px dashed #ccc;
  padding: 20px 10px;
  background-color: #F5F5F5;
}
.header {
    margin: 10px 0;
  span {
    margin-right: 15px;
  }
}
</style>
